#define _CRT_SECURE_NO_WARNINGS 1

class MinStack {
public:
    MinStack()
        // :_min(new stack<int>)
        // ,_save(new stack<int>)
    {
        //_min = new stack<int>[10];
        //_save = new stack<int>[10];

        // _min = nullptr;
        // _save = nullptr;
    }

    void push(int val) {
        _save.push(val);
        if (_min.size() == 0 || val <= _min.top())
            _min.push(val);
    }

    void pop() {
        if (_save.top() == _min.top())
            _min.pop();

        _save.pop();
    }

    int top() {
        return _save.top();
    }

    int getMin() {
        return _min.top();
    }
    stack<int> _save;
    stack<int> _min;
};

/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack* obj = new MinStack();
 * obj->push(val);
 * obj->pop();
 * int param_3 = obj->top();
 * int param_4 = obj->getMin();
 */